package com.hustcs.mindmap;

import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.util.Log;
import android.widget.Toast;


public class SettingActivity extends PreferenceActivity implements Preference.OnPreferenceChangeListener{	
	private static final String TAG = "SettingActivity";
	private ListPreference languagePref;
	private String setLanguageKey;

	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		addPreferencesFromResource(R.xml.setting_activity);	
		
		setLanguageKey = getResources().getString(R.string.set_language_key);
		languagePref = (ListPreference)findPreference(setLanguageKey);
		
		if (languagePref != null)
			languagePref.setOnPreferenceChangeListener(this);
	}

	
	public boolean onPreferenceChange(Preference preference, Object newValue) {
		Log.d(TAG, "onPreferenceChange");
		
		if (preference.getKey().equals(setLanguageKey)) {
			Toast.makeText(this, R.string.language_change_remind, Toast.LENGTH_LONG).show();
		}
		return true;
	}
}
